#ifndef DOCK_WINDOW_MANANGER_H_H_H_
#define DOCK_WINDOW_MANANGER_H_H_H_


//#include "PreCompiled.h"
#include <QStringList>

class QDockWidget;

struct DockWindowItem
{
	QString name;
	Qt::DockWidgetArea pos;
	bool visibility;
	bool tabbed;
};
class DockWindowItems
{
public:
	DockWindowItems();
	~DockWindowItems();

	void addDockWidget(const char* name,Qt::DockWidgetArea pos,bool visibility,bool tabbed);
	void setDockingArea(const char* name,Qt::DockWidgetArea pos);
	void setVisibility(const char* name,bool v);
	void setVisibility(bool v);
	const QList<DockWindowItem>& dockWidgets()const;

private:
	QList<DockWindowItem> _items;
};

class DockWindowManager :	public QObject
{
	Q_OBJECT
public:

	static DockWindowManager* instance();
	static void destruct();


	bool registerDockWindow(const char* name,QWidget* widget);


	QDockWidget* addDockWindow(const char* name,QWidget* widget,Qt::DockWidgetArea = Qt::AllDockWidgetAreas);
	QWidget* removeDockWindow(const char* name);
	void     removeDockWindow(QWidget* dock);

	QWidget* getDockWindow(const char* name)const;
	QList<QWidget*>getDockWindows()const;

   void setup(DockWindowItems* items);



private Q_SLOTS:

	void onDockWidgetDestroyed(QObject*);

	void OnWidgetDestroyed(QObject*);

private:
	QDockWidget* findDockWidget(const QList<QDockWidget*>&,const QString&)const;

	DockWindowManager(void);
	~DockWindowManager(void);

	static DockWindowManager* _instance;
	struct DockWindowManagerP* d;
	

};
#endif